1. Field of the Invention
This invention relates to microprocessors, and more particularly, to maintaining and performing efficient program instrumentation for memory profiling.
2. Description of the Relevant Art
Software programmers write applications to perform work according to an algorithm or a method. The program's performance may be increased based on an understanding of the dynamic behavior such as a memory profile of the entire program. Inefficient portions of the program such as memory leaks may be improved once the inefficiencies are known. In addition, understanding a program's dynamic behavior may be useful in computer architecture research, compiler research, or other. Such research may focus on trace generation, branch prediction techniques, cache memory subsystem modeling, fault tolerance studies, or other. Generally speaking, what is needed is a single, compact description of a program's entire control flow including loop iterations and inter-procedural paths.
Accurate instruction traces are needed to determine a program's dynamic behavior by capturing a program's dynamic control flow, not just its aggregate behavior. Programmers, compiler writers, and computer architects can use these traces to improve performance. Without tools to efficiently identify expensive program portions such as memory leaks or errors, it is difficult to improve the performance of software. Further, as processor speeds have increased, it has become more difficult to collect complete execution traces for applications. This is in part due to the sheer number of instructions in such a trace, and also in part due to the performance overhead required to capture these traces.
Many known systems for profiling memory in user applications use instrumentation techniques for monitoring and profiling memory-access patterns. The memory instrumentation comprises detection of memory-related operations (such as load and store operations) and insertion of additional code such as instrumentation code and analysis code that communicates to the profiling system properties of the aforementioned operations such as a corresponding address, a data block size, a program counter value, or other.
One common use for memory profiling is to detect memory-related program errors such as un-initialized memory usage, an array out-of-bounds access, or other. However, instrumentation code brings performance overhead. Straightforward instrumentation of each memory access operation may negatively affect run-time performance of the application. It may be common for a typical memory error detection system to reduce execution time of an application by a factor of 50. For example, a memory profiling system may be used for a server wherein the server requires hours to run the regular server code to test all major code paths. With a straightforward instrumentation, it may take days or even weeks to perform memory profiling.
In view of the above, efficient methods and mechanisms for maintaining efficient program instrumentation for memory profiling is desired.